/**
 * 
 */
package org.jft.datamodel.database.dao.implementation;

import java.sql.SQLException;
import java.util.List;

import org.hibernate.Session;
import org.jft.datamodel.database.HibernateUtil;
import org.jft.datamodel.database.dao.GenericDAO;
import org.jft.datamodel.database.mapping.State;

/**
 * @author LAP
 *
 */
public class StateDAO extends GenericDAO<State> {

	@Override
	public State getByID(Long id) throws SQLException {
		Session session = HibernateUtil.getInstance().getSessionFactory().getCurrentSession();
		State state = (State) session.load(State.class, id);
		return state;
	}

	@Override
	public List<State> getAll() throws SQLException {
		Session session = HibernateUtil.getInstance().getSessionFactory().getCurrentSession();
		List<State> states = session.createCriteria(State.class).list();
		return states;
	}

}
